#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::keyPressEvent(QKeyEvent *event)
{
    //打印出来的是枚举值
    //qDebug()<<event->key();

    if(event->key()==Qt::Key_A)
        qDebug()<<"按下A";
    if(event->key()==Qt::Key_A&&event->modifiers()==Qt::ControlModifier)
        qDebug()<<"按下ctrl+A";
}

